﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:local="clr-namespace:WaitCursor;assembly=WaitCursor"
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"    
    >

    <Style TargetType="local:WaitCursorControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:WaitCursorControl">

                    <Border x:Name="waitControl" Background="{TemplateBinding Background}">
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="Common">
                                <vsm:VisualState x:Name="Collapsed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="00:00:00" Storyboard.TargetName="waitControl" Storyboard.TargetProperty="(Border.Visibility)">
                                            <ObjectKeyFrameCollection>
                                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Visibility>Collapsed</Visibility>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectKeyFrameCollection>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Visible">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Duration="00:00:00" Storyboard.TargetName="waitControl" Storyboard.TargetProperty="(Border.Visibility)">
                                            <ObjectKeyFrameCollection>
                                                <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Visibility>Visible</Visibility>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectKeyFrameCollection>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:03" Storyboard.TargetName="point1" Storyboard.TargetProperty="(Ellipse.Fill).(SolidColorBrush.Color)" RepeatBehavior="Forever">
                                            <ColorKeyFrameCollection>
                                                <LinearColorKeyFrame Value="Black" KeyTime="00:00:00.5" />
                                                <LinearColorKeyFrame Value="White" KeyTime="00:00:01" />
                                            </ColorKeyFrameCollection>
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames BeginTime="00:00:00.5" Duration="00:00:03" Storyboard.TargetName="point2" Storyboard.TargetProperty="(Ellipse.Fill).(SolidColorBrush.Color)" RepeatBehavior="Forever">
                                            <ColorKeyFrameCollection>
                                                <LinearColorKeyFrame Value="Black" KeyTime="00:00:00.5" />
                                                <LinearColorKeyFrame Value="White" KeyTime="00:00:01" />
                                            </ColorKeyFrameCollection>
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames BeginTime="00:00:01" Duration="00:00:03" Storyboard.TargetName="point3" Storyboard.TargetProperty="(Ellipse.Fill).(SolidColorBrush.Color)" RepeatBehavior="Forever">
                                            <ColorKeyFrameCollection>
                                                <LinearColorKeyFrame Value="Black" KeyTime="00:00:00.5" />
                                                <LinearColorKeyFrame Value="White" KeyTime="00:00:01" />
                                            </ColorKeyFrameCollection>
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames BeginTime="00:00:01.5" Duration="00:00:03" Storyboard.TargetName="point4" Storyboard.TargetProperty="(Ellipse.Fill).(SolidColorBrush.Color)" RepeatBehavior="Forever">
                                            <ColorKeyFrameCollection>
                                                <LinearColorKeyFrame Value="Black" KeyTime="00:00:00.5" />
                                                <LinearColorKeyFrame Value="White" KeyTime="00:00:01" />
                                            </ColorKeyFrameCollection>
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames BeginTime="00:00:02" Duration="00:00:03" Storyboard.TargetName="point5" Storyboard.TargetProperty="(Ellipse.Fill).(SolidColorBrush.Color)" RepeatBehavior="Forever">
                                            <ColorKeyFrameCollection>
                                                <LinearColorKeyFrame Value="Black" KeyTime="00:00:00.5" />
                                                <LinearColorKeyFrame Value="White" KeyTime="00:00:01" />
                                            </ColorKeyFrameCollection>
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames BeginTime="00:00:02.5" Duration="00:00:03" Storyboard.TargetName="point6" Storyboard.TargetProperty="(Ellipse.Fill).(SolidColorBrush.Color)" RepeatBehavior="Forever">
                                            <ColorKeyFrameCollection>
                                                <LinearColorKeyFrame Value="Black" KeyTime="00:00:00.5" />
                                                <LinearColorKeyFrame Value="White" KeyTime="00:00:01" />
                                            </ColorKeyFrameCollection>
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>

                        <Grid>
                            <Ellipse x:Name="point1" Height="10" Width="10" Fill="#FFFFFFFF" Stroke="#44000000" Margin="-100, -50, 0, 0"/>
                            <Ellipse x:Name="point2" Height="10" Width="10" Fill="#FFFFFFFF" Stroke="#44000000" Margin="0, -100, 0, 0"/>
                            <Ellipse x:Name="point3" Height="10" Width="10" Fill="#FFFFFFFF" Stroke="#44000000" Margin="100, -50, 0, 0"/>
                            <Ellipse x:Name="point4" Height="10" Width="10" Fill="#FFFFFFFF" Stroke="#44000000" Margin="100, 50, 0, 0"/>
                            <Ellipse x:Name="point5" Height="10" Width="10" Fill="#FFFFFFFF" Stroke="#44000000" Margin="0, 100, 0, 0"/>
                            <Ellipse x:Name="point6" Height="10" Width="10" Fill="#FFFFFFFF" Stroke="#44000000" Margin="-100, 50, 0, 0"/>
                            <TextBlock Text="{TemplateBinding Text}"  HorizontalAlignment="Center" VerticalAlignment="Center"/>
                        </Grid>
                    </Border>

                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>